package com.itbaizhan.springbootdemo4;

import com.itbaizhan.springbootdemo4.listener.SecondListener;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ListenerConfig {
    //启动后listener会自动启动，不用加路径
    @Bean
    public ServletListenerRegistrationBean getServletListenerRegistrationBean(){
        //注册listener组件
        ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean(new SecondListener());
       return bean;
    }
}
